<template>
  <view class="panel hot">
    <view class="item" v-for="item in list" :key="item.id">
      <view class="title">
        <view class="title-text">{{ item.title }}</view>
        <view class="title-desc">{{ item.alt }}</view>
      </view>
      <navigator :url="`/pages/hot/hot?type=${item.type}`" class="cards">
        <image
          v-for="(src, index) in item.pictures"
          :key="index"
          :src="src"
          mode="aspectFill"
        ></image>
      </navigator>
    </view>
  </view>
</template>

<script setup lang="ts">
import type { HomeItem } from '@/types/home'

const props = defineProps<{
  list: HomeItem[]
}>()
</script>

<style lang="scss" scoped>
.hot {
  display: flex;
  flex-wrap: wrap;
  min-height: 508rpx;
  margin: 20rpx 20rpx 0;
  border-radius: 10rpx;
  background-color: #fff;
  .item {
    display: flex;
    flex-flow: column;
    // align-items: center;
    justify-content: center;
    width: 50%;
    height: 254rpx;
    border-right: 1rpx solid #eee;
    &:nth-child(2n) {
      //偶数个
      border-right: 0 none;
    }
    &:nth-child(-n + 2) {
      //头两个
      border-right: 0 none;
    }
    .title {
      display: flex;
      // justify-items: start;
      align-items: center;

      padding: 24rpx 0;
      position: relative;

      .title-text {
        margin-left: 15rpx;
        font-size: 32rpx;
      }
      .title-desc {
        color: #7f7f7f;
        margin-left: 18rpx;
        font-size: 24rpx;
      }
    }
    .cards {
      display: flex;
      flex: 1;
      justify-content: space-around;
      image {
        width: 150rpx;
        height: 150rpx;
      }
    }
  }
}
</style>
